<template>
	<view></view>
</template>

<script setup>
	import { onLoad, onLaunch, onShow, onHide } from '@dcloudio/uni-app';
	import { ref } from 'vue';
	import setting from "@/common/config.js"; 
	import { useThemeStore } from '@/store/theme.js';
	import { getShareApp } from '@/until/wxShare.js' 
	import { useRoute } from 'vue-router'
	const route = useRoute()
	const store = useThemeStore();

	
	// 监听路由变化
	watch(() => route.path, (newPath) => {
		console.log(newPath, 'newPath')
		if (newPath !== '/pages/account/firing/enter' && newPath != '/pagesOrder/view/pay/alipay') { // 假设首页路径是 /home
			// 执行你需要的操作
			getShareApp()
		}
	})

	onLaunch(async (option) => {

	})
	
	onShow(() => {
		console.log(setting);
		// 根据接口返回的类型去替换背景颜色跟其它等
		// let testTheme = { 'type': '001' } //群青青年酒馆
		let testTheme = { 'type':'002'} //空白区
		// let testTheme = { 'type':'003'} //在逃兔兔
		// let testTheme = { 'type':'004'} //踏歌行
		// let testTheme = { 'type':'005'} //赤红
		// let testTheme = { 'type':'006'} //馨现场
		// let testTheme = { 'type':'007'} //ams
		// let testTheme = { 'type':'008'} //艾斯酒吧
		if(setting.APP_PATH == 'https://jtmckj.com/qnjg/' ){
			testTheme = { 'type': '001' }
		}else if(setting.APP_PATH == 'https://jtmckj.com/kbq/' ){
			testTheme = { 'type': '002' }
		}else if(setting.APP_PATH == 'https://jtmckj.com/zttt/' ){
			testTheme = { 'type': '003' }
		}else if(setting.APP_PATH == 'https://jtmckj.com/tgx/' ){
			testTheme = { 'type': '004' }
		}else if(setting.APP_PATH == 'https://jtmckj.com/ch/' ){
			testTheme = { 'type': '005' }
		}else if(setting.APP_PATH == 'https://jtmckj.com/xxc/' ){
			testTheme = { 'type': '006' }
		}else if(setting.APP_PATH == 'https://jtmckj.com/ams/' ){
			testTheme = { 'type': '007' }
		}else if(setting.APP_PATH == 'https://jtmckj.com/as/' ){
			testTheme = { 'type': '008' }
		}
		
		store.SetThemeInfo(testTheme)
		// document.documentElement.style.setProperty('--maincolor', '#000000'); 
		document.documentElement.style.setProperty('--mainbacgroundcolor', '#ececec');

		if (testTheme.type == '001') {
			// 群青青年酒馆  --  可变样式
			document.documentElement.style.setProperty('--dt-colorPink', '#FE0190'); //字体颜色主色
			document.documentElement.style.setProperty('--dt-backcolorPink', '#fe0190'); //背景色主色
			document.documentElement.style.setProperty('--dt-bordercolorPink', '#fe0190'); //边框色主色
		} else  {
			document.documentElement.style.setProperty('--dt-colorPink', '#212121'); //字体颜色主色
			document.documentElement.style.setProperty('--dt-backcolorPink', '#212121'); //背景色主色
			document.documentElement.style.setProperty('--dt-bordercolorPink', '#e5e5e5'); //边框色主色    
		}
		// console.log('主题类型type：',store.themeInfo.type)
		// console.log('App Show!')
	})
	
	onHide(() => {
		// console.log('App Hide!')
	})
	
</script>

<style lang="scss">
	@import "uview-plus/index.scss";
	@import "@/style/comm_style.scss";
	@import "@/style/theme_style.scss";
	@import "@/style/chxy_style.scss";
</style>